<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <hello-world></hello-world>
        <hello-tom></hello-tom>
        <hello-jerry></hello-jerry>
        <test-com></test-com>
    </div>
    <script type="text/javascript" src="js/vue.js"></script>
    <script type="text/javascript">
        //局部组件只能在注册他的父组件中使用
        Vue.component('test-com', {
            template: '<div>Test</div>'
                //template: '<div>Test<hello-world></hello-world></div>'  false
        });

        //局部组件注册
        var HelloWorld = {
            data: function() {
                return {
                    msg: 'helloworld'
                }
            },
            template: '<div>{{msg}}</div>'
        };
        var HelloTom = {
            data: function() {
                return {
                    msg: 'HelloTom'
                }
            },
            template: '<div>{{msg}}</div>'
        };
        var HelloJerry = {
            data: function() {
                return {
                    msg: 'HelloJerry'
                }
            },
            template: '<div>{{msg}}</div>'
        }
        var vm = new Vue({
            el: '#app',
            data: {

            },
            components: {
                'hello-world': HelloWorld,
                'hello-tom': HelloTom,
                'hello-jerry': HelloJerry
            }
        });
    </script>
</body>

</html>